<?php
include_once 'constants.php';
session_start();
if(isset($_SESSION[$sessionLoginTag])){
	header('location:index.php');
	exit;
}
$email = isset($_GET['email'])?$_GET['email']:null;
if(!$email)return;
if(!filter_var($email,FILTER_VALIDATE_EMAIL))return;
$phone = isset($_GET['phone'])?$_GET['phone']:null;
if(!$phone)return;
$phone = trim($phone);
if(strlen($phone)!=10||!is_numeric($phone))return;
$alias = isset($_GET['alias'])?$_GET['alias']:null;
if(!$alias)return;
$encrypted = encrypt("$email;$phone;$alias",$encryptKey);
echo $encrypted;
$decrypted = decrypt($encrypted,$encryptKey);
echo '<br/>'.$decrypted;
function encrypt($pure_string, $encryption_key) {
	$iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB);
	$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
	$encrypted_string = mcrypt_encrypt(MCRYPT_BLOWFISH, $encryption_key, utf8_encode($pure_string), MCRYPT_MODE_ECB, $iv);
	return $encrypted_string;
}
function decrypt($encrypted_string, $encryption_key) {
	$iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB);
	$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
	$decrypted_string = mcrypt_decrypt(MCRYPT_BLOWFISH, $encryption_key, $encrypted_string, MCRYPT_MODE_ECB, $iv);
	return $decrypted_string;
}
?>